package com.rickpan;

import com.rickpan.storage.StorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.scheduling.annotation.EnableScheduling;

/**
 * RickPan 企业网盘应用启动类
 *
 * @author RickPan Team
 * @version 1.0.0
 */
@SpringBootApplication
@EnableJpaAuditing  // JPA审计功能
@EnableScheduling
public class RickPanApplication implements CommandLineRunner {

    @Autowired
    private StorageService storageService;

    public static void main(String[] args) {
        SpringApplication.run(RickPanApplication.class, args);
        System.out.println("🚀 RickPan 企业网盘启动成功！");
        System.out.println("📱 前端地址: http://localhost:5173");
        System.out.println("🔧 后端地址: http://localhost:8080");
        System.out.println("📊 API文档: http://localhost:8080/swagger-ui.html");
    }

    @Override
    public void run(String... args) throws Exception {
        // 初始化存储
        storageService.initStorage();
        System.out.println("📁 存储服务初始化完成: " + storageService.getStorageType());
    }
}
